﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class media_MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
            Validation.PerformValidation(Page);

        Page.LoadComplete += new EventHandler(Page_LoadComplete);
    }

    protected void Page_LoadComplete(object sender, EventArgs e)
    {
        if (HttpContext.Current.Session != null)
        {
            Validation.ValidationMessages.ForEach(m => MessagePanel.Controls.Add(new LiteralControl("<p>" + m + "</p>")));
            MessagePanel.Visible = (Validation.ValidationMessages.Count > 0);
            Validation.ValidationMessages.Clear();
        }
    }
}
